package de.uni_potsdam.hpi.bpt.ai.example;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.HashSet;
import java.util.Set;

import org.json.JSONException;
import org.springframework.util.StringUtils;

import de.uni_potsdam.hpi.bpt.ai.diagram.StencilSetFactory;

public class StencilSetPrinter {
	
	protected static void getAndPrint(String namespace) throws UnsupportedEncodingException, FileNotFoundException, JSONException, IOException {
		Set<String> constructs = new HashSet<String>();
		for (String st : StencilSetFactory.getInstance().getStencilSet(namespace).getStencils()) {
			constructs.add(st);
		}
		
		System.out.println(namespace + " has " + constructs.size() + " constructs");
		System.out.println(StringUtils.collectionToCommaDelimitedString(constructs));
		System.out.println();
		
	}
	
	public static void main(String[] args) throws UnsupportedEncodingException, FileNotFoundException, JSONException, IOException {
		for (String ns : new String[]{
				"http://b3mn.org/stencilset/epc#",
				"http://b3mn.org/stencilset/petrinet#",
				"http://b3mn.org/stencilset/bpmn1.1#",
				"http://b3mn.org/stencilset/bpmn2.0#"
		}) {
			getAndPrint(ns);
		}
	} 
}
